<?php
include_once("functions/db_manipulate.php");

if (!init()) {
    redirect("?action=login");
    exit();
}

?>
<meta charset="UTF-8">
<?php


$topicsResultSet = getNewTopics();

?>

<div class="userscontent">
    <div class="blockheader">
        Предложения новых тем:
    </div>

    <?php
    while ($topic = mysql_fetch_assoc($topicsResultSet)) {
        ?>
        <div class="user">
            <div class="usertd">
                <?= $topic['nick'] ?>
            </div>
            <div class="usertd">
                <?= $topic['header'] ?>
            </div>
            <div class="usertd">
                <?= $topic['section'] ?>
            </div>

        </div>
        <div class="blockuserbutton" onclick="$('#askuserdelete<?= $topic['id'] ?>').slideDown()">
            Опции
        </div>
        <div id="askuserdelete<?= $topic['id'] ?>" class="askuserdelete">
            При удалении тема будет удалена безвозвратно<br>

            <div class="askuserdeletebutton" style="margin-left: 100px;"
                 onclick="location.href='?action=createtopic&tid=<?= $topic['id'] ?>'">
                Создать
            </div>
            <div class="askuserdeletebutton" onclick="location.href='?action=deletetopic&tid=<?= $topic['id'] ?>'">
                Удалить
            </div>
            <div class="askuserdeletebutton" onclick="$('#askuserdelete<?= $topic['id'] ?>').slideUp()">
                Отмена
            </div>

        </div>
    <?
    }
    ?>

</div>
